<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <meta http-equiv="X-UA-Compatible" content="ie=edge" />
        <meta name="viewport" content="width=device-width, initial-scale=1.0" />
        <title>Document</title>
        <style>
            [v-cloak] {
                display: none;
            }
        </style>
    </head>
    <body>
        <div id="app">
            <li v-cloak v-for="item in newsList" :key="item.id">{{item.title}}</li>
        </div>
        <script src="../vue.js"></script>
        <script src="../jquery-3.5.1.min.js"></script>
        <script src="https://unpkg.com/axios/dist/axios.min.js"></script>
        <script>
            let vm = new Vue({
                el: '#app',
                data() {
                    return {
                        newsList: [],
                    };
                },
                methods: {
                    getNewsList() {
                        axios({
                            method: 'post',
                            url: 'http://macio.ncyateng.com/api/news/index',
                            // data: {
                            //     firstName: 'Fred',
                            //     lastName: 'Flintstone',
                            // },
                        }).then((res) => {
                            let {
                                data: { newsList },
                            } = res;
                            // console.log(this);
                            this.newsList = newsList;
                            console.log(res);
                        });
                    },
                },
                created() {
                    this.getNewsList();
                },
            });
            // $.ajax({
            //     type: 'get',
            //     url: 'http://macio.ncyateng.com/api/news/index',
            //     // data: "data",
            //     dataType: 'json',
            //     success: function (response) {
            //         console.log(response);
            //         console.log(this); // ajax
            //         vm.newsList = response.newsList;
            //     },
            // });

            let obj = {
                name: 'wangjin',
                age: 18,
                obj2: {
                    height: 182,
                },
            };
            // obj.name
            let {
                age,
                name,
                obj2: { height },
            } = obj;
            console.log(name); // 'wangjin'
            console.log(age); // 18
            console.log(height);

            let [a, b, [c, [d]]] = [20, 30, [40, [50]]];
            console.log(a); // 20
            console.log(b); // 30
            console.log(c); // 40
            console.log(d); // 50
        </script>
    </body>
</html>
